
function setDeal(showtype, id, f_edit_m, btkey, notcheck) {
	var data = {};
	if(!notcheck) {
		for(var name in editable) {
			var getinfo = editable[name];
			if(getinfo.notedit) continue;
			var value = '';
			if(getinfo.type == 'richtext') {
				value = window.frames['umeditor_ifr_' + name].getContent();
			} else {
				value = $G.getValue('edit_' + name);
			}
			data[name] = value;
		}
		try	{
			var rs = checkBefore(data);
			if(rs === false) return ;
		} catch (e){}
	}

	data = {};
	
	for(var name in editable) {
		var getinfo = editable[name];
		
		if(getinfo.notedit) {
			var value = '';
			try {
				value = $G.getValue('edit_' + name);
			} catch (e) { }
			data["notedit_" + name] = value;
			continue;
		}
	//	if(getinfo.type == 'hidden') continue;
		var value = '';
		if(getinfo.type == 'richtext') {
			value = window.frames['umeditor_ifr_' + name].getContent();
		} else {
			value = $G.getValue('edit_' + name);
		}
		
		if(!notcheck) {
			var cz = '填写';
			if(getinfo.must == '1' && value == '') {
				var edittitle = getinfo.title.replace(/<[^>]+>/g,"");
				if(getinfo.type == 'select' || getinfo.type == 'checkbox' || getinfo.type == 'radio') {
					cz = '选择';
					alert("请选择" + edittitle + '!');
				} else if(getinfo.type == 'file') {
					cz = '上传';
					alert("请上传" + edittitle + ' 的文件!');
				} else {
					alert("请填写" + edittitle + '!');
				}
				
				return ;
			}
		}
		if(value != '') {
			if(getinfo.checkfunc) {//^1\d{10}$
					
				if(!eval(getinfo.checkfunc+'("'+value+'", "'+getinfo.title+'", "'+cz+'")')) {
					return ;
				}
			}
			/*if(getinfo.reg) {//^1\d{10}$
				
				if(!new RegExp(getinfo.reg).test(value)) {
					alert(getinfo.title + '填写格式不正确!');
					return ;
				}
			}*/
		}

		data[name] = value;
	}
	if(!notcheck) {
		try	{
			var data2 = checkMore(data);
			if(data2 === false) return ;
			data = data2;
		} catch (e){}
	}
	
	data['id'] = id;
	if(editparam && editparam != '') {
		for(var i in editparam) {
			data[i] = editparam[i];
		}
	}
	
	var m = 'save';
	if(typeof(f_edit_m) != 'undefined') m = f_edit_m;

	var btid = "savebt";
	if(btkey) btid += "_"+btkey;

	var btvalue = $(btid).value;
	$(btid).value = '正在提交..';
	$(btid).disabled = true;
	
	$G.ajax("?act=show&showtype="+showtype+"&m="+m, data, function(rs) {
		try {
			$(btid).value = btvalue;
			$(btid).disabled = false;
		} catch (e){}
		if(!check_rs(rs)) {
			if(rs && rs.data && rs.data.extraJs && rs.data.extraJs != '') {
				eval(rs.data.extraJs);
			}
			return false;
		}
		if(rs.data && rs.data.extraJs && rs.data.extraJs != '') {
			eval(rs.data.extraJs);
		} else {
			if(rs.message != '') {
				alert(rs.message);
			}
			hideInfo();
			getListData();
		}
		
		
	}, 'json', 'POST');
	
}


function select_change_link(v, id, keys) {
	var info = window[keys];
	$(id).selectedIndex = 0;
	$(id).options.length = 1;
	
	if(v == '' || v == 0) return ;
	var info2 = info[v];
	var has = {};
	for(var k in info2) {
		var op = new Option(info2[k], k);
		has[k] = 1;
		$(id).options.add(op);
	}
	if(id.indexOf("edit_") === 0) {
		var id2 = id.substr(5);
		if(edit_data && edit_data[id2] && edit_data[id2] != '' && edit_data[id2] != '0') {
			if(typeof(has[edit_data[id2]]) != 'undefined') $(id).value = edit_data[id2];
		}
	}
}

function open_url(url, title) {
	if(!title) title = '';
	<? if($isphone) { ?>
	var is_pic = false;
	var a = url.split(".");
	if(a.length > 1) {
		var ext = a[a.length - 1].toLowerCase();
		if(ext == 'jpg' || ext == 'jpeg' || ext == 'png' || ext == 'gif') is_pic = true;
	}
	if(!is_pic) {
		window.open(url);
		return ;
	}
	try {
		var items = [];
		items.push({src: url,w: 600,h: 800, title:title});
		var pswpElement = document.querySelectorAll('.pswp')[0];
		var options = {index: 0, arrowEl: true};
		var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
		var has = false;
		gallery.listen('imageLoadComplete', function(index, item) {
			if(has) return ;
			function checkPhotoSwipeImg() {
				var div = item.container;
				var a = div.getElementsByTagName("img");
				if(a.length > 0) {
					var img = a[0];
					item.w = img.naturalWidth;
					item.h = img.naturalHeight;
					gallery.invalidateCurrItems();
					gallery.updateSize(true);
				} else {
					setTimeout(checkPhotoSwipeImg, 50);
				}
			}
			setTimeout(checkPhotoSwipeImg, 50);
			has = true;
			
		});
		gallery.init();
	} catch (e) {
		window.open(url);
		return ;
	}

	<? } else { ?>
		window.open(url);
	<? } ?>
}